package com.tec.cloud.notice.web;

import com.tec.cloud.notice.service.ConfigService;
import com.tec.cloud.notice.vo.ConfigVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("config")
public class ConfigController {

    ConfigService configService;

    public ConfigController(ConfigService configService) {
        this.configService = configService;
    }

    @GetMapping("{type}/list")
    public List<ConfigVO> list(@PathVariable String type) {
        return configService.list(type);
    }

    @GetMapping("{key}")
    public ConfigVO get(@PathVariable String key) {
        return configService.getByKey(key);
    }
}
